﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MTQ.DAL.DBView
{
    public class SortingResult
    {
        private string sqlConnect;
        public SortingResult()
        {
            sqlConnect = ConfigurationManager.ConnectionStrings["MTQFramework"].ToString();
        }


        public DataSet GetDataPage(string tableName, int _pagerIndex, int _pagerSize, string WhereString, string _orderString)
        {

            DataSet dt = SqlHelperPage.GetDataPage(sqlConnect, "*", "result" + tableName, _pagerIndex, _pagerSize, WhereString, _orderString);
            // DataSet dt = SqlHelperPage.GetData(sqlConnect, "*", "result20200307", 1, 30, " 1=1 ", " ID desc ");

            return dt;
        }
        public DataSet GetDataNoPage(string tableName, string WhereString, string _orderString)
        {

            DataSet dt = SqlHelperPage.GetDataNoPage(sqlConnect, "*", "result" + tableName, WhereString, _orderString);
            // DataSet dt = SqlHelperPage.GetData(sqlConnect, "*", "result20200307", 1, 30, " 1=1 ", " ID desc ");

            return dt;
        }

        public DataTable GetData(string sql) {
           return SqlHelper.ExecuteDataset(sqlConnect, CommandType.Text, sql).Tables[0];
        }

    }
}
